package com.mhwx.mhlive.ui.activity;


import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;

import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.hintview.ColorPointHintView;
import com.mhwx.mhlive.R;
import com.mhwx.mhlive.ui.adapter.GridViewAdapter;
import com.mhwx.mhlive.ui.adapter.HotNormalAdapter;
import com.mhwx.mhlive.ui.base.BaseActivity;
import com.mhwx.mhlive.ui.widget.GridViewWithHeaderAndFooter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import in.srain.cube.views.ptr.PtrClassicFrameLayout;

/**
 * 类功能描述
 * 个人主页
 * @author Guol
 * @version 1.0
 * @copyright 北京明华维新信息技术有限公司
 * @time 2017/5/9
 */
public class PersonalHomepage extends BaseActivity {

    @BindView(R.id.gridview)
    GridViewWithHeaderAndFooter mGridView;

    @BindView(R.id.rotate_header_grid_view_frame)
    PtrClassicFrameLayout mPtrFrame;

    RollPagerView mRollViewPager;
    private View headView;
    private List<String> mDatas;

    private GridViewAdapter mAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_perlsonal);

        init();
        setData();
    }

    private void init(){
        mDatas=new ArrayList<>();
          mGridView.addHeaderView(getViewId());


    }
    private void setData(){
        for (int i=0;i<20;i++){
            mDatas.add(i+"");
        }
        mAdapter=new GridViewAdapter(this,mDatas);

        mGridView.setAdapter(mAdapter);
        mGridView.setNumColumns(2);
    }

    private View getViewId(){
        headView = LayoutInflater.from(this).inflate(R.layout.item_hot_hear,null , false);
        mRollViewPager= (RollPagerView) headView.findViewById(R.id.roll_view_pager);
        //设置播放时间间隔
        mRollViewPager.setPlayDelay(1000);
        //设置透明度
        mRollViewPager.setAnimationDurtion(500);
        //设置适配器
        mRollViewPager.setAdapter(new HotNormalAdapter());
        // 设置圆点指示器颜色
        mRollViewPager.setHintView(new ColorPointHintView(this, Color.WHITE, Color.GRAY));
        return headView;
    }
}
